﻿using System;
using System.Collections.ObjectModel;
using System.Threading;
using Mido.Domain;

namespace Mido.UiModules.ScrollBarModule
{
    internal class ScrollBarModel
    {
	    internal event ThreadStart SelectedItemChanged;
        private readonly ObservableCollection<ProcessedImage> _images;

        private ProcessedImage _activeImage = null;

        internal ScrollBarModel(ObservableCollection<ProcessedImage> images)
        {
            if (images == null) 
                throw new ArgumentNullException("images");

            _images = images;
        }

        internal ObservableCollection<ProcessedImage> Images
        {
            get { return _images; }
        }

        internal ProcessedImage ActiveImage
        {
            get { return _activeImage; }
            set
            {
				if (_activeImage == value)
					return;

	            _activeImage = value;

				if (SelectedItemChanged != null)
					SelectedItemChanged();
            }
        }
    }
}
